//
//  Exchanger.h
//  PIDAMRX
//
//  Created by Patrick Zulian on 4/7/11.
//  Copyright 2011 ICS - USI - Lugano. All rights reserved.
//

#ifndef PIDAMRX_Exchanger_H
#define PIDAMRX_Exchanger_H

/**
 * \brief The Exchanger class ... TODO Doc
 * \tparam T 
 */ 
template< typename Relation >
class Exchanger {
private:
    Relation relation;
    Communicator communicator;
    
public:
	Exchanger(Communicator &communicator, Relation relation)
    : communicator(communicator), relation(relation)
    {}
    
    
	/**
	 *	The copy constructor
	 *	\param other the object from which the data is copied from. All fields are to be copied
	 *	
	 */
	Exchanger(const Exchanger &other)
    : relation(other.relation), communicator(other.communicator)
	{ }
	
	/**
	 *	The copy operator
	 *	\param other the object from which the data is copied from. All fields are to be copied
	 *	
	 */
	Exchanger & operator=(const Exchanger &other)
	{
		if (this == &other) {
			return *this;
		}
	
        this->relation = other.relation;
        this->communicator = other.communicator;
		
		return *this;
	}
	
	/**
	 * The Destructor
	 */
	~Exchanger()
	{ }
	
    template< class Tree >
    bool exchange( const Tree &tree, const int maxDepth)
    {
        
        
        //TODO ALL the stuff
        communicator.clear();
        return false;
    }
};


#endif //PIDAMRX_Exchanger_H

